package pkg

import (
	"0411zk/rpc/models"
)

func UserRegister(mobile string, password string) (int, error) {
	u := models.User{}
	userMobile, err := u.FindUserMobile(mobile)
	if userMobile != nil {
		return 0, err
	}

	user, err := u.CreateUsers(mobile, password)
	if err != nil {
		return 0, err
	}
	return int(user.ID), nil
}
